#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;

ll dis(ll x, ll y)
{
    ll len = 0;
    if (y >= -x)
    {
        if (y > x)
        {
            len = 4 * y * y;
            len = len - abs(x - y);
        }
        else
        {
            len = 4 * x * x;
            len = len + abs(x - y);
        }
    }
    else
    {
        if (y > x + 1)
        {
            len = (abs(2 * x) - 1) * (abs(2 * x) - 1);
            len += (y - x) - 1;
        }
        else
        {
            len = (abs(2 * y) + 1) * (abs(2 * y) + 1);
            len -= (x - y + 1);
        }
    }
    return len;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll x, y;
    cin >> x >> y;
    ll sum = dis(x, y);
    cout << sum << endl;
    return 0;
}